<?php 

 header("Content-type: text/html; charset=utf-8");
require("conn.php");

$user = $_POST['user'];
$user=json_decode($user,true);

if($user['password']!=''){
$sql = "UPDATE  user SET username='".$user['username']."',password='".$user['password']."',sex= '".$user['sex']."',age='".$user['age']."',pic='".$user['pic']."' WHERE id = '".$user['uid']."'    ";
}else{
$sql = "UPDATE  user SET username='".$user['username']."',sex= '".$user['sex']."',age='".$user['age']."',pic='".$user['pic']."'  WHERE id = '".$user['uid']."'    ";
}

if (mysql_query($sql,$conn)) {
	echo 'y';
}else{
	echo mysql_error();
}